package com.aboverock.module.system.service;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.IService;
import com.aboverock.module.system.domain.Role;
import com.aboverock.module.system.domain.UserRole;

/**
 * <p>
 * 服务类
 * </p>
 * .
 *
 * @author Rock Wang
 * @since 2018-04-10
 */
public interface UserRoleService extends IService<UserRole> {

    /**
     * 根据用户id获取其所属的角色列表.
     *
     * @param userId the user id
     * @return the roles by user id
     */
    public List<Role> getRolesByUserId(String userId);

    /**
     * 获取指定角色id下的所有用户id.
     *
     * @param roleId the role id
     * @return the user ids by role id
     */
    public List<String> getUserIdsByRoleId(String roleId);

    /**
     * 删除某个角色与指定用户的user-role关系映射.
     *
     * @param roleId the role id
     * @param userIds the user ids
     * @return true, if successful
     */
    public boolean removeByRoleIdAndUserIds(String roleId, List<String> userIds);

    /**
     * 删除指定用户的所有user-role关系映射.
     *
     * @param userIds the user ids
     * @return true, if successful
     */
    public boolean removeByUserIds(List<String> userIds);

    /**
     * 给指定用户添加common角色.
     *
     * @param userId the user id
     * @return true, if successful
     */
    public boolean addCommonRole(String userId);
}
